package com.thb.pay.core.bean;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.thb.pay.core.enums.ProtocolEnum;
import lombok.*;

import java.io.Serializable;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class PushMsg implements Serializable {

    /**
     * 序列
     */
    private static final long serialVersionUID = -8965296513558252958L;

    /**
     * 服务名称
     */
    private String service;

    /**
     * 方法名称
     */
    private String method;

    /**
     * 会话Id
     */
    private String seq;

    /**
     * 源地址(发送端)
     */
    private String srcAddr;

    /**
     * 请求标识
     */
    private String requestId;

    /**
     * 消息体
     */
    private Object payload;

    /**
     * ack回应内容
     */
    private MsgAck ack;

    /**
     * 主题
     */
    @JSONField(serialize = false)
    private String topic;
    /**
     * clientId
     */
    private String clientId;

    /**
     * 签名
     */
    private String sign;

    /**
     * 所属协议
     */
    private ProtocolEnum protocol;


    public String toString() {
        return JSON.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect);
    }
}
